<!-- 开放管理-预约资料-本院人员 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="6">
            <el-form-item label="所属学院">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="学年届">
              <el-input v-model="listQuery.fcatno" placeholder="学年届" clearable />
            </el-form-item>
          </el-col>

          <template v-if="showAll">

          <el-col :span="6">
            <el-form-item label="所属年级">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          
          <el-col :span="6">
            <el-form-item label="所属班级">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="学生名称">
              <el-input v-model="listQuery.fcatname" placeholder="学生名称" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="申请状态">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <!-- <el-button type="primary" icon="el-icon-plus" @click="insert(undefined)">新增</el-button> -->
              <!-- <el-button type="success" icon="el-icon-download">导出</el-button> -->
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FHOME" label="所属学院"></el-table-column>
          <el-table-column prop="FYEAR" label="学年届" width="80"></el-table-column>
          <el-table-column prop="FPARENTNO" label="所属年级" width="80"></el-table-column>
          <el-table-column prop="FCLASS" label="所属班级"></el-table-column>
          <el-table-column prop="FCATNO" label="学籍号" ></el-table-column>
          <el-table-column prop="FCATNAME" label="学生姓名"></el-table-column>
          <el-table-column prop="FBEGDATE" label="有效起日" width="90"></el-table-column>
          <el-table-column prop="FENDDATE" label="有效讫日" width="90"></el-table-column>
          <el-table-column prop="FNOTE" label="状态" width="75"></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="90">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                查看
              </el-button>
              <!-- <el-popconfirm title="确定禁止当前人员预约？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-delete" style="color: red;margin-left: 10px;"
                  type="text">禁用</el-button>
              </el-popconfirm> -->
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        options1: [{
          value: '1',
          label: '化学与材料科学学院'
        }, {
          value: '2',
          label: '生命科学学院'
        }],

        //所属校区选择数据
        options2: [{
          value: 'L001',
          label: '大一'
        }, {
          value: 'L002',
          label: '大二'
        }, {
          value: 'L003',
          label: '大三'
        }, {
          value: 'L004',
          label: '大四'
        }],

        //所属校区选择数据
        options3: [{
          value: 'L001',
          label: '化学系1班'
        }, {
          value: 'L002',
          label: '化学系2班'
        }],

        options4: [{
          value: 'L001',
          label: '未开通'
        }, {
          value: 'L002',
          label: '已开通'
        }],

        customlist:[
          {
            "FBILLNO": "K241130001", 
            "FBILLCREDATE":"2024-11-30",
            "FUSER": "曹操",
            "FMEMO": "有机化学实验操作课",
            "FBEGDATE": "2024-12-01",
            "FENDDATE": "2025-11-30",
            "FCHECKUSE": "",
            "FCHECKDATE": "",
            "FNOTE":"",
            "FBILLSTATE": "申请中"
          },
        ],
        list: [
            {
            "FHOME":"化学与材料科学学院",
            "FYEAR": 2024,
            "FPARENTNO": "大一",
            "FCLASS":"化学系1班",
            "FCATNO": "241001",
            "FCATNAME": "曹操",
            "FSEX": "男",
            "FBEGDATE": "2024-12-01",
            "FENDDATE": "2025-11-30",
            "FNOTE":"已开通",
            "FOPERATOR": "system",
            "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
            },{
            "FHOME":"化学与材料科学学院",
            "FYEAR": 2024,
            "FPARENTNO": "大一",
            "FCLASS":"化学系1班",
            "FCATNO": "241002",
            "FCATNAME": "刘备",
            "FSEX": "男",
            "FBEGDATE": "2024-12-01",
            "FENDDATE": "2025-11-30",
            "FNOTE":"未开通",
            "FOPERATOR": "system",
            "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
            },
            ,{
            "FHOME":"化学与材料科学学院",
            "FYEAR": 2024,
            "FPARENTNO": "大一",
            "FCLASS":"化学系1班",
            "FCATNO": "241003",
            "FCATNAME": "关羽",
            "FSEX": "男",
            "FBEGDATE": "2024-12-01",
            "FENDDATE": "2025-11-30",
            "FNOTE":"已禁止",
            "FOPERATOR": "system",
            "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
            },{
            "FHOME":"化学与材料科学学院",
            "FYEAR": 2024,
            "FPARENTNO": "大一",
            "FCLASS":"化学系1班",
            "FCATNO": "241004",
            "FCATNAME": "张飞",
            "FSEX": "男",
            "FBEGDATE": "2024-12-01",
            "FENDDATE": "2025-11-30",
            "FNOTE":"已开通",
            "FOPERATOR": "system",
            "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
            },{
            "FHOME":"生命科学学院",
            "FYEAR": 2022,
            "FPARENTNO": "大三",
            "FCLASS":"22级生物系1班",
            "FCATNO": "222001",
            "FCATNAME": "华佗",
            "FSEX": "男",
            "FBEGDATE": "2024-12-01",
            "FENDDATE": "2025-11-30",
            "FNOTE":"已开通",
            "FOPERATOR": "system",
            "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>